/*
package CastSqlToJavaMethod;

//这些需要调用framework.jar里面的方法

public class paging {
    public static String DB_TYPE_ORACLE = "oracle";
    public static String DB_TYPE_MYSQL = "mysql";

    public static String testSql(){
//        String sql = "",sqlFront = "",sqlMiddle = "",sqlRear = "";
        String sql = "",sqlFront = "user_id",sqlMiddle = "SELECT inner_tb.* FROM tb_sys_user AS inner_tb GROUP BY inner_tb.user_id",sqlRear = "1";

//        这个是frameworkjar包里面的方法
//        sqlMethod sqlMethod = new sqlMethod();
//
//        sql = sqlMethod.getRowNoOfRowIdSql(sqlFront,sqlRear,sqlMiddle);

        return sql;
    }
//    public static String distinguishDataBase(){
////        仿照DbEngine.init();
//        String dataBase = "";
//// 放在项目里面可以拿到这个dbtype，放到孤立的java文件里面拿不到
//        //        这个是frameworkjar包里面的方法
//
////        String dbtype = AppConfig.getInstance().getConfigValue("product_conf_dbtype");
//
//        if (DB_TYPE_ORACLE.equals(dbtype)) {
//            dataBase = DB_TYPE_ORACLE;
//        } else {
//            dataBase = DB_TYPE_MYSQL;
//        }
//        return dataBase;
//    }

    public static String mysqlReplaceLimit(String oldSql,Integer startIndex,Integer endIndex){
        oldSql = oldSql.replaceFirst("[S,s][E,e][L,l][E,e][C,c][T,t]","");
        String sql = "";
        sql = "SELECT\n" + "\touter_tb.* \n" + "FROM\n" + "\t( SELECT @rownum := 0 ) r, ( SELECT ( @rownum := @rownum + 1 ) AS ids ,\n" + oldSql + "\t) AS outer_tb " + "HAVING\n" + "\touter_tb.ids BETWEEN " + startIndex + " AND " + endIndex;
        return sql;
    }
    public static String oracleReplaceLimit(String oldSql,Integer startIndex,Integer endIndex){
        oldSql = oldSql.replaceFirst("[S,s][E,e][L,l][E,e][C,c][T,t]","");
        String sql = "";
        sql = "SELECT\n" + "\touter_tb.* \n" + "FROM\n" + "\t( SELECT @rownum := 0 ) r, ( SELECT ( @rownum := @rownum + 1 ) AS ids ,\n" + oldSql + "\t) AS outer_tb " + "HAVING\n" + "\touter_tb.ids BETWEEN " + startIndex + " AND " + endIndex;
        return sql;
    }
    public static void main(String[] args) {
        String testSql = testSql();


        String dataBase = distinguishDataBase();
        String pagingSql = "SELECT\n" +
                "user_tb.*\n" +
                "FROM\n" +
                "tb_sys_user user_tb";
        if(DB_TYPE_MYSQL.equals(dataBase)){
            pagingSql = mysqlReplaceLimit(pagingSql,1,20);
        }else {
            pagingSql = oracleReplaceLimit(pagingSql,1,20);
        }

    }


}
*/
